﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace BCDEditUI
{
    public partial class ucCreateVhd : UserControl
    {
        public ucCreateVhd()
        {
            InitializeComponent();
        }

        private void btnSelectParentVhd_Click(object sender, EventArgs e)
        {
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                tbxParentVhd.Text = ofd.FileName;
            }
        }

        public Form1 MainForm
        {
            get
            {
                return ParentForm as Form1;
            }
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (rbDifferencingDisk.Checked)
            {
                CreateDifferencingDisk();
            }
        }

        private void CreateDifferencingDisk()
        {
            MainForm.Output = DiskPart.CreateDifferencingDisk(MainForm.FileName, tbxParentVhd.Text);
        }

        public void SetArgs(string[] args)
        {
            string arg = string.Join(" ", args, 1, args.Length - 1);

            tbxParentVhd.Text = arg;
        }

    }
}
